import 'package:flutter/material.dart';

class AppTheme {
  static const Color appColorPrimaryValue = Color(0xFF4285f4);
  static const Color accentColor = Color(0xFF1185f8);
  static const Color greyColor = Color(0xFFf5f5f5);
  static const Color homeBGColor = Color(0xffE2EFFF);

  /// 主题按钮渐变色
  static const List<Color> btnGradientColors = [Color(0xFF4285f4), Color(0xFF1185f8)];

  /// 主题背景色
  static final List<Color> bgColors = [Color(0xffE2EFFF), Colors.white.withAlpha(0)];

  static List<Color> btnDisableGradientColors() {
    return [Color(0xFF528eed).withAlpha(100), Color(0xFF215ced).withAlpha(100)];
  }

  // 移除 MaterialColor 定义，fromSeed 不需要调色板
  // 保留作为参考或备用
  static MaterialColor appColor = MaterialColor(
    0xFF4285f4,
    <int, Color>{
      50: appColorPrimaryValue.withAlpha(255).withOpacity(0.1),
      100: appColorPrimaryValue.withAlpha(255).withOpacity(0.2),
      200: appColorPrimaryValue.withAlpha(255).withOpacity(0.3),
      300: appColorPrimaryValue.withAlpha(255).withOpacity(0.4),
      400: appColorPrimaryValue.withAlpha(255).withOpacity(0.5),
      500: appColorPrimaryValue,
      600: Color(0xFF306ded),
      700: Color(0xFF206cee),
      800: Color(0xFF205bee),
      900: Color(0xFF104aee),
    },
  );

  static ThemeData light() => ThemeData(
    useMaterial3: true,
    dividerColor: const Color(0xFFEEEEEE),
    primaryColor: appColor,
    colorScheme: ColorScheme.fromSeed(
      seedColor: appColorPrimaryValue,  // 使用种子颜色生成主色
      secondary: accentColor,           // 显式设置次要色（原强调色）
      brightness: Brightness.light,
      outlineVariant: const Color(0xFFEEEEEE),
    ).copyWith(
      primary: appColor,
      surface: const Color(0xFFFFFFFF), // 手动设置 surface 颜色
      background: const Color(0xFFf8f8f8), // 手动设置背景色以匹配原设计
      surfaceVariant: const Color(0xFFFFFFFF),
    ),
    scaffoldBackgroundColor: const Color(0xFFf8f8f8), // 保持原有脚手架背景
    appBarTheme: const AppBarTheme(
      backgroundColor: appColorPrimaryValue,
      foregroundColor: Colors.white,
      elevation: 0,
    ),
    textTheme: const TextTheme(
      displayLarge: TextStyle(
        color: Colors.white,
        fontSize: 20,
        fontWeight: FontWeight.bold,
      ),
      titleMedium: TextStyle(
        color: Colors.black,
        fontSize: 15,
        fontWeight: FontWeight.normal,
      ),
    ),
    dialogBackgroundColor: Colors.white,
    pageTransitionsTheme: const PageTransitionsTheme(
      builders: {
        TargetPlatform.android: ZoomPageTransitionsBuilder(),
      },
    ),
  );

  static ThemeData dark() => ThemeData(
    useMaterial3: true,
    dividerColor: const Color(0xFF4d4d4d),
    primaryColor: appColor,
    colorScheme: ColorScheme.fromSeed(
      seedColor: appColorPrimaryValue,  // 使用相同的种子颜色
      secondary: accentColor,           // 保持相同的次要色
      brightness: Brightness.dark,
      outlineVariant: const Color(0xFF4d4d4d),
    ).copyWith(
      primary: appColor,
      surface: const Color(0xFF242424), // 手动设置 surface 颜色
      background: const Color(0xFF121212), // 手动设置背景色
    ),
    scaffoldBackgroundColor: const Color(0xFF121212), // 保持原有脚手架背景
    appBarTheme: const AppBarTheme(
      backgroundColor: Color(0xFF1E1E1E),
      elevation: 0,
    ),
    dialogBackgroundColor: const Color(0xFF242424),
    pageTransitionsTheme: const PageTransitionsTheme(
      builders: {
        TargetPlatform.android: ZoomPageTransitionsBuilder(),
      },
    ),
  );
}